package com.bookmall.member.config;

import com.bookmall.member.interceptor.MemberInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description:
 * @Author 胡菜鸡
 * @Create 2022-04-15-18:33
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    /**
     * 设置拦截器拦截路径
     * @author 胡菜鸡
     * @date 2022/4/17 9:50
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        InterceptorRegistration registration = registry.addInterceptor(new MemberInterceptor());
        //添加拦截路径
        registration.addPathPatterns("/center.html");
        //添加放行路径
//        registration.excludePathPatterns(
//            "/member/**"
//        );
    }
}
